<template>
	<view>
		<view class="u-padding-20 u-border-bottom">
			<text class="red_xing">❉</text>
			<text class="title_con">今日完成工作</text>
			<textarea class="text_con" v-model="complete" auto-height maxlength="-1" placeholder="请输入" />
		</view>
		<view class="u-padding-20 u-border-bottom">
			<text class="red_xing">❉</text>
			<text class="title_con">未完成工作及原因</text>
			<textarea class="text_con" v-model="un_complete" auto-height maxlength="-1" placeholder="请输入" />
		</view>
		<view class="u-padding-20 u-border-bottom">
			<text class="red_xing">❉</text>
			<text class="title_con">今日存在问题</text>
			<textarea class="text_con" v-model="problem" auto-height maxlength="-1" placeholder="请输入" />
		</view>
		<view class="u-padding-20 u-border-bottom">
			<text class="red_xing">❉</text>
			<text class="title_con">明日计划内容</text>
			<textarea class="text_con" v-model="plan" auto-height maxlength="-1" placeholder="请输入" />
		</view>
		<view class="u-padding-20 u-border-bottom">
			<text class="red_xing white">❉</text>
			<text class="title_con">市场信息内容</text>
			<textarea class="text_con" v-model="info" auto-height maxlength="-1" placeholder="请输入" />
		</view>
		<view class="u-padding-20 u-border-bottom">
			<text class="red_xing white">❉</text>
			<text class="title_con">意见及建议内容</text>
			<textarea class="text_con" v-model="report" auto-height maxlength="-1" placeholder="请输入" />
		</view>
		<view class="u-padding-20">
			<view style="font-size: 28rpx;">图片</view>
			
			<u-upload :action="action" :fileList="fileList" @on-success="successimg" @on-remove="deletePic" max-count="9"></u-upload>
		</view>
		<!-- 占位 -->
		<view style="height:130rpx"></view>
		<view class="fixed-bottom">
			<view class="dis_inl_blo" @click="toback">
				<u-icon name="file-text" color="#666" size="35"></u-icon>
				<text class="dis_blo" style="font-size: 26rpx;">看日志</text>
			</view>
			<button type="default" @click="sureSubmit">提交日志</button>
		</view>
		<!-- 弹框提示 -->
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	import {
		editLog
	} from "@/service/indexService.js";
	export default {
		data () {
			return {
				action:'https://admin.gslhzhwy.com/api/upload/file',
				images:[],
				fileList: [],
				complete:'',
				un_complete:'',
				problem:'',
				plan:'',
				info:'',
				report:''
			}
		},
		methods:{
			successimg:function(e){
				if (e.code == 1) {
					this.images.push(e.data.url);
				}
			},
			// 删除图片
			deletePic(event) {
				this.images.splice(event.index,1);
			},
			toback:function(){
				uni.navigateBack()
			},
			sureSubmit:function(){
				editLog({
					complete:this.complete,
					un_complete:this.un_complete,
					problem:this.problem,
					plan:this.plan,
					info:this.info,
					report:this.report,
					images:this.images
				}).then(res=>{
					if(res.code==200){
						this.$refs.uToast.show({
						
							type: 'success',
							title: '提交成功',
							icon:false
							// message: e.msg,
						})
						setTimeout(function(){
							uni.navigateBack();
						},2000)
					}else{
						this.$refs.uToast.show({
						
							type: 'error',
							title: res.msg,
							icon:false
							// message: e.msg,
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.red_xing{
		color:red;font-size: 20rpx;
		margin-right: 10rpx;
		vertical-align: top;
	}
	.white{
		color:#fff;
	}
	.title_con{
		color:#333;font-size: 28rpx;
		vertical-align: top;
	}
	.text_con{
		width: 94%;
		padding:0 25rpx;
		margin:20rpx auto 50rpx;
		overflow:visible !important;
	}
	.fixed-bottom{
		position: fixed;
		bottom:0;
		height:120rpx;
		width:100%;
		text-align: center;
		background-color: #fff;
		border-top: 1rpx solid #ddd;
	}
	.fixed-bottom button{
		display: inline-block;
		width:75%;
		height:70rpx;
		line-height: 70rpx;
		color:#fff;
		margin-top:25rpx;
		margin-left:40rpx;
		font-size: 30rpx;
		background-color: #0c838b;
		border-radius: 20rpx;
	}
	
	.pre-box {
		margin-top:20rpx;
	}
	
	.pre-item {
		// flex: 1;
		display: inline-block;
		border-radius: 10rpx;
		width:200rpx;
		height: 200rpx;
		overflow: hidden;
		position: relative;
		margin-bottom: 20rpx;
		margin-left:10rpx;
	}
	
	.pre-item-image {
		width: 100%;
		height: 100%;
	}
</style>
